<template>
	<div>
		<p>头部:{{name}}</p>
		<input :value="keyword" @input="$emit('update:keyword',$event.target.value)" />
		<button @click="butFn">获父组件的值和方法</button>
		<button @click="mittFn">mitt 组件传值</button>
	</div>
</template>

<script>
import event from "../model/event";
export default {
	data() {
		return {
			name: "刘协议"
		};
	},
	props: ["keyword", "firstName"],
	created() {
		console.log("keyword:", this.keyword, this.firstName);
	},
	methods: {
		getName() {
			console.log("子组件的方法");
			this.$emit("call-val", "$emit 传值");
		},
		butFn() {
			console.log(this.$parent.msg);
			this.$parent.fatherFn();
		},
		mittFn() {
			event.emit("headerFn", "mitt传值");
		}
	}
};
</script>

<style>
</style>    